package com.ruoyi.system.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Configuration
public class OssConfig {

    // 区域
    @Value("${spring.cloud.alicloud.oss.endpoint}")
    private String endpoint;

    // key
    @Value("${spring.cloud.alicloud.access-key}")
    private String accessKeyId;

    // 密钥
    @Value("${spring.cloud.alicloud.secret-key}")
    private String accessKeySecret;


    @Bean
    public OSS ossClientBuilder(){
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }

}
